package com.learning.platform.dto;

import com.learning.platform.entity.Exam;
import com.learning.platform.enums.ExamStatus;
import com.learning.platform.enums.ExamType;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

public class ExamResponse {
    private Long id;
    private Long courseId;
    private String courseName; // 课程名称
    private String title;
    private String description;
    private ExamType examType;
    private Integer timeLimit;
    private BigDecimal totalPoints;
    private BigDecimal passScore;
    private Integer maxAttempts;
    private LocalDateTime startTime;
    private LocalDateTime endTime;
    private ExamStatus status;
    private Boolean showResult;
    private Boolean showCorrectAnswers;
    private Boolean shuffleQuestions;
    private Boolean shuffleOptions;
    private Long createdBy;
    private String creatorName; // 创建者姓名
    private LocalDateTime createdAt;
    private LocalDateTime updatedAt;
    
    // 统计信息
    private Integer questionCount; // 题目数量
    private Integer attemptCount; // 尝试次数
    private BigDecimal averageScore; // 平均分
    private Integer userAttempts; // 当前用户尝试次数
    private Boolean canTakeExam; // 是否可以参加考试
    private ExamRecordResponse latestRecord; // 最新考试记录
    
    // 题目列表（用于考试详情）
    private List<ExamQuestionResponse> questions;
    
    // Constructors
    public ExamResponse() {}
    
    public ExamResponse(Exam exam) {
        this.id = exam.getId();
        this.courseId = exam.getCourseId();
        this.title = exam.getTitle();
        this.description = exam.getDescription();
        this.examType = exam.getExamType();
        this.timeLimit = exam.getTimeLimit();
        this.totalPoints = exam.getTotalPoints();
        this.passScore = exam.getPassScore();
        this.maxAttempts = exam.getMaxAttempts();
        this.startTime = exam.getStartTime();
        this.endTime = exam.getEndTime();
        this.status = exam.getStatus();
        this.showResult = exam.getShowResult();
        this.showCorrectAnswers = exam.getShowCorrectAnswers();
        this.shuffleQuestions = exam.getShuffleQuestions();
        this.shuffleOptions = exam.getShuffleOptions();
        this.createdBy = exam.getCreatedBy();
        this.createdAt = exam.getCreatedAt();
        this.updatedAt = exam.getUpdatedAt();
    }
    
    // Getters and Setters
    public Long getId() {
        return id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }
    
    public Long getCourseId() {
        return courseId;
    }
    
    public void setCourseId(Long courseId) {
        this.courseId = courseId;
    }
    
    public String getCourseName() {
        return courseName;
    }
    
    public void setCourseName(String courseName) {
        this.courseName = courseName;
    }
    
    public String getTitle() {
        return title;
    }
    
    public void setTitle(String title) {
        this.title = title;
    }
    
    public String getDescription() {
        return description;
    }
    
    public void setDescription(String description) {
        this.description = description;
    }
    
    public ExamType getExamType() {
        return examType;
    }
    
    public void setExamType(ExamType examType) {
        this.examType = examType;
    }
    
    public Integer getTimeLimit() {
        return timeLimit;
    }
    
    public void setTimeLimit(Integer timeLimit) {
        this.timeLimit = timeLimit;
    }
    
    public BigDecimal getTotalPoints() {
        return totalPoints;
    }
    
    public void setTotalPoints(BigDecimal totalPoints) {
        this.totalPoints = totalPoints;
    }
    
    public BigDecimal getPassScore() {
        return passScore;
    }
    
    public void setPassScore(BigDecimal passScore) {
        this.passScore = passScore;
    }
    
    public Integer getMaxAttempts() {
        return maxAttempts;
    }
    
    public void setMaxAttempts(Integer maxAttempts) {
        this.maxAttempts = maxAttempts;
    }
    
    public LocalDateTime getStartTime() {
        return startTime;
    }
    
    public void setStartTime(LocalDateTime startTime) {
        this.startTime = startTime;
    }
    
    public LocalDateTime getEndTime() {
        return endTime;
    }
    
    public void setEndTime(LocalDateTime endTime) {
        this.endTime = endTime;
    }
    
    public ExamStatus getStatus() {
        return status;
    }
    
    public void setStatus(ExamStatus status) {
        this.status = status;
    }
    
    public Boolean getShowResult() {
        return showResult;
    }
    
    public void setShowResult(Boolean showResult) {
        this.showResult = showResult;
    }
    
    public Boolean getShowCorrectAnswers() {
        return showCorrectAnswers;
    }
    
    public void setShowCorrectAnswers(Boolean showCorrectAnswers) {
        this.showCorrectAnswers = showCorrectAnswers;
    }
    
    public Boolean getShuffleQuestions() {
        return shuffleQuestions;
    }
    
    public void setShuffleQuestions(Boolean shuffleQuestions) {
        this.shuffleQuestions = shuffleQuestions;
    }
    
    public Boolean getShuffleOptions() {
        return shuffleOptions;
    }
    
    public void setShuffleOptions(Boolean shuffleOptions) {
        this.shuffleOptions = shuffleOptions;
    }
    
    public Long getCreatedBy() {
        return createdBy;
    }
    
    public void setCreatedBy(Long createdBy) {
        this.createdBy = createdBy;
    }
    
    public String getCreatorName() {
        return creatorName;
    }
    
    public void setCreatorName(String creatorName) {
        this.creatorName = creatorName;
    }
    
    public LocalDateTime getCreatedAt() {
        return createdAt;
    }
    
    public void setCreatedAt(LocalDateTime createdAt) {
        this.createdAt = createdAt;
    }
    
    public LocalDateTime getUpdatedAt() {
        return updatedAt;
    }
    
    public void setUpdatedAt(LocalDateTime updatedAt) {
        this.updatedAt = updatedAt;
    }
    
    public Integer getQuestionCount() {
        return questionCount;
    }
    
    public void setQuestionCount(Integer questionCount) {
        this.questionCount = questionCount;
    }
    
    public Integer getAttemptCount() {
        return attemptCount;
    }
    
    public void setAttemptCount(Integer attemptCount) {
        this.attemptCount = attemptCount;
    }
    
    public BigDecimal getAverageScore() {
        return averageScore;
    }
    
    public void setAverageScore(BigDecimal averageScore) {
        this.averageScore = averageScore;
    }
    
    public Integer getUserAttempts() {
        return userAttempts;
    }
    
    public void setUserAttempts(Integer userAttempts) {
        this.userAttempts = userAttempts;
    }
    
    public Boolean getCanTakeExam() {
        return canTakeExam;
    }
    
    public void setCanTakeExam(Boolean canTakeExam) {
        this.canTakeExam = canTakeExam;
    }
    
    public ExamRecordResponse getLatestRecord() {
        return latestRecord;
    }
    
    public void setLatestRecord(ExamRecordResponse latestRecord) {
        this.latestRecord = latestRecord;
    }
    
    public List<ExamQuestionResponse> getQuestions() {
        return questions;
    }
    
    public void setQuestions(List<ExamQuestionResponse> questions) {
        this.questions = questions;
    }
}